Date: 18 september 2003, Version: 1.6
Rich Editor (RE) is a browser-based online WYSIWYG html editor. The editor is to be used in content management systems or just instead of <TEXTAREA> tags in forms to create/edit html formatted text and whole html pages.
100% script (javascript and php). Easy to install. No additional Java Applets or ActiveX components are required! Works with Internet Explorer 5.x+ only. MSIE 6.x is recommended. Implemented as a PHP class. Multiple instances of RE on the same page are supported.
No knowledge of HTML required. Advanced work with images, including file uploading, tables, links, stylesheets, flash and more!
Active and simple modes of the editor. Adjustable toolbar. Work with server-side files and folders. Colored source code. Multilanguage support. And more!
Note: if you do not see local flash preview, please, install the latest version of flash player from macromedia.com.
You must have possibility to run PHP scripts inside your files and rights to write in your directories at server!
<?php $class_path = "path to 'class' folder"; require_once($class_path."class.rich.php"); ?>Here
<link rel="StyleSheet" type="text/css" href="<?php echo $class_path; ?>rich_files/rich.css"> <script language="JavaScript" src="<?php echo $class_path; ?>rich_files/rich.js"></script>
<?php $editor = new rich($caption, $name, $value, $width, $height, $files_path, $files_url, $page_mode, $absolute_path); $editor->draw(); ?>Here
Note: if $absolute_path is set to false, $files_path and $files_url should specify path to folder for uploading relative to site root. I.e. if folder for uploading is 'http://www.yoursite.com/files/upload/', these variables should be set to '/files/upload/'. In this case, all urls in the editor will not depend on name of site domain.
<form action="" method="post" onsubmit="save_in_textarea_all();">
RE appears on page in the place, where method draw() is called.
To handle RE Simple mode add a sring of the form
$editor->simple_mode($mode);before draw() method call.
To hide some buttons use the method
$editor->hide_tb($item, $mode);before draw() method call.
Here
Using the hide_tb() function it is possible to hide some buttons of RE toolbar. Besides it, you can set up your own "simple mode" adding or deleting the function calls inside simple_mode() function.
The possible values of $item:
To handle RE Active mode add a sring of the form
$editor->active_mode($mode);before draw() method call.
To set default stylesheet files use the following function:
$editor->set_default_stylesheet($style_path);before draw() method call.
Here
To define html snippets to be used in the editor use the following function:
$editor->set_snippets($snippets);before draw() method call.
Here
array('name' => 'name of the snippet', 'code' => 'code of the snippet')
To set a desired language use the following function:
$editor->set_lang($lang);before draw() method call.
Here
Supported languages (language codes):
The new language will be available by the code {code} in set_lang() method.
Note: full description of RE installation and using see in INSTALLATION&USING section and in file example.php. This is examples of RE php class using only.
Example1. Default mode
$editor = new rich('Example #1', 'rich_name', 'initial_content',
'100%', '100%', 'files/', 'http://www.yourdomain.com/files/');
$editor->draw();
Example2. Active mode
$editor = new rich('Example #2', 'rich_name', 'initial_content',
500, 500, 'files/', 'http://www.yourdomain.com/files/');
$editor->active_mode();
$editor->draw();
Example3. Simple mode
$editor = new rich('Example #3', 'rich_name', 'initial_content',
'100%', 300, 'files/', 'http://www.yourdomain.com/files/');
$editor->simple_mode();
$editor->draw();
Example4. Adjustable toolbar (turn off image and table buttons)
$editor = new rich('Example #4', 'rich_name', 'initial_content',
500, '80%', 'files/', 'http://www.yourdomain.com/files/');
$editor->hide_tb('image');
$editor->hide_tb('table');
$editor->draw();
Example5. Default stylesheets
$editor = new rich('Example #5', 'rich_name', 'initial_content',
'100%', '100%', 'files/', 'http://www.yourdomain.com/files/');
//to load style1.css and style2.css you can write
$editor->set_default_stylesheet('style1.css');
$editor->set_default_stylesheet('style2.css');
/*or (the same result)
$editor->set_default_stylesheet(array('style1.css','style2.css'));
*/
$editor->draw();
Example6. Snippets
$editor = new rich('Example #6', 'rich_name', 'initial_content',
500, 500, 'files/', 'http://www.yourdomain.com/files/');
$snippets = array();
$snippets[] = array('name'=>'Snippet 1 name', 'code'=>'Snippet 1 code');
$snippets[] = array('name'=>'Snippet 2 name', 'code'=>'Snippet 2 code');
$editor->set_snippets($snippets);
$editor->draw();
Example7. Relative paths
$editor = new rich('Example #7', 'rich_name', 'initial_content',
500, 500, '/files/', '/files/', false, false);
$editor->draw();
Example8. Language
$editor = new rich('Example #8', 'rich_name', 'initial_content',
'100%', 400, '/files/', '/files/', true, false);
$editor->set_lang('ru'); //set language to russian
$editor->draw();
Software License Agreement
RICH EDITOR AND ANY DOCUMENTATION PROVIDED TO YOU (COLLECTIVELY THE "SOFTWARE" OR "RE") COVERED BY THIS AGREEMENT IS COPYRIGHTED AND IS LICENSED, NOT SOLD. BY TAKING POSSESSION OF THE SOFTWARE, YOU AND YOUR COMPANY (COLLECTIVELY "YOU") ARE ACCEPTING AND AGREEING TO THE TERMS OF THIS LICENSE AGREEMENT
1. All copyrights to RE are exclusively owned by the author - Vyacheslav Smolin.
2. You agree to take reasonable steps to keep in confidence and protect the software provided to you from unauthorized copying or use. These steps include, without limitation, obtaining the agreement of all persons having access to the Software that they will respect the terms of this License and using the Software in such a way as to prevent unauthorized copying.
3. There are 2 basic types of licenses issued for the Software, these are:
| a. | General license. You may not use the Software to create content for third parties, or that will be linked to or framed by other web sites related to you in any way, including without limitation third parties' web sites created by you unless third parties have a separate license for the Software. You may not use the Software in your commercial products. |
| b. | Rebrandable license. You may use the Software to create content for third parties, or in your commercial products. In this case you must provide obtaining the agreement of all third parties and your customers having access to the Software that they will respect the terms of this license and use the Software in such a way as to prevent unauthorized copying. |
Once you paid a license fee, you are granted a non-exclusive right to use the Software only as authorized in this license. Number of servers and domains are not limited. All payments are non refundable. You may assign your right to use the Software to a third party provided that you cease using your licensed copy of the Software and the content produced by it.
4. THE SOFTWARE IS DISTRIBUTED "AS IS". NO WARRANTY OF ANY KIND IS EXPRESSED OR IMPLIED. YOU USE IT AT YOUR OWN RISK. NEITHER THE AUTHOR NOR THE AGENTS OF THE AUTHOR WILL BE LIABLE FOR DATA LOSS, DAMAGES, LOSS OF PROFITS OR ANY OTHER KIND OF LOSS WHILE USING OR MISUSING THIS SOFTWARE.
5. You may not sub-license, share, rent, or lease your right to use the Software. You also agree not to create derivative works of the Software for any reason. Any unauthorized use shall result in immediate and automatic termination of this license and may result in criminal and/or civil prosecution.
6. All copyright notices used throughout the Software, within the scripts and within the HTML that the scripts generate, must remain intact.
7. Installing and using the Software signifies acceptance of terms and conditions of the license.
| Copyright © 2002, 2003 by Vyacheslav Smolin. All rights reserved. | Top of the document Table of contents |